package com.terrynoya.fight.data.parser.sff
{
	import flash.utils.ByteArray;
	import flash.utils.Endian;

	public class SffParser
	{
		public function SffParser()
		{
			
		}
		
		public static function decode(bytes:ByteArray):SpriteMaker
		{
			
			bytes.endian=Endian.LITTLE_ENDIAN;
			
			var headerBytes:Bytes=new Bytes(512);
			headerBytes.write(bytes);
			bytes.position = 0;
			var version:SFFVersion = new SFFVersion(headerBytes.data, 12);
			
			var maker:SpriteMaker;
			if(version.type == SFFVersion.SFF_V2)
			{
				var reader:SFFReader = new SFFReader(bytes);
				maker= new SpriteMaker(reader);
			}
			return maker;
		}
	}
}